package com.aaa.member.controller;

import com.aaa.common.constant.ExceptionConstant;
import com.aaa.common.constant.ReturnCode;
import com.aaa.common.util.CustomException;
import com.aaa.common.util.Result;
import com.aaa.member.entity.CommonAddress;
import com.aaa.member.entity.CommonCustomer;
import com.aaa.member.service.CommonCustomerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * (CommonCustomer)表控制层
 *
 * @author makejava
 * @since 2020-11-27 14:58:50
 */
@RestController
@RequestMapping("commonCustomer")
public class CommonCustomerController {
    /**
     * 服务对象
     */
    @Resource
    private CommonCustomerService commonCustomerService;

    /**
     * 查询会员常用联系人
     * @param commonCustomer
     * @return
     */
    @GetMapping("queryAllPeople")
    public Result queryAllPeople(CommonCustomer commonCustomer){
        System.out.println(commonCustomer.getMemberId());
        if(commonCustomer.getMemberId()==null){
            throw new CustomException(ExceptionConstant.INVALID_ARGUMENT.getErrorCode(),
                    ExceptionConstant.INVALID_ARGUMENT.getErrorMessage());
        }
        return new Result(ReturnCode.SUCCESSS.getCode(),
                ReturnCode.SUCCESSS.getMsg(),commonCustomerService.queryAllPeople(commonCustomer));
    }
}